package com.synergy.stockflow.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.v3.oas.annotations.media.Schema;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 角色表
 */
@Schema(description = "角色表")
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "sys_role")
@JsonSerialize
public class SysRole {
    /**
     * 角色编号
     */
    @TableId(value = "role_id", type = IdType.AUTO)
    @Schema(description = "角色编号")
    private Integer roleId;

    /**
     * 多租户标识
     */
    @TableField(value = "tenant_id")
    @Schema(description = "多租户标识")
    private String tenantId;

    /**
     * 角色编码
     */
    @TableField(value = "role_code")
    @Schema(description = "角色编码")
    private String roleCode;

    /**
     * 角色名称
     */
    @TableField(value = "role_name")
    @Schema(description = "角色名称")
    private String roleName;

    /**
     * 角色描述
     */
    @TableField(value = "remark")
    @Schema(description = "角色描述")
    private String remark;

    /**
     * 状态
     */
    @TableField(value = "`status`")
    @Schema(description = "状态")
    private Byte status;

    /**
     * 创建人
     */
    @TableField(value = "create_by")
    @Schema(description = "创建人")
    private Long createBy;

    /**
     * 创建时间
     */
    @TableField(value = "create_time")
    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 更新者
     */
    @TableField(value = "update_by")
    @Schema(description = "更新者")
    private Long updateBy;

    /**
     * 更新时间
     */
    @TableField(value = "update_time")
    @Schema(description = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    @TableField(exist = false)
    @Schema(description = "权限/功能")
    private List<SysRolePerm> rolePerms;
}